package com.zhiwei.project.constants;

/**
 * @author ZHIWEI.YANG
 * @time 2019/11/10 - 17:58
 * @decription 发版系统字典类型枚举
 */
public enum ProjectDictTypeEnum {

    ROOT("00000", "顶级字典分类"),
    LANGUAGE("00001", "编程语言"),
    BUILD("00002", "构建类型"),
    DEPLOY("00003", "部署类型"),
    PROJECT("00004", "项目类型");

    /**
     * 字典类型编码
     */
    private String typeCode;

    /**
     * 字典类型描述
     */
    private String desc;

    ProjectDictTypeEnum(String typeCode, String desc) {
        this.typeCode = typeCode;
        this.desc = desc;
    }

    /**
     * 通过字典类型编码获取数据字典枚举
     *
     * @param typeCode 字典类型编码
     * @return
     */
    public static ProjectDictTypeEnum getPublishDictTypeEnumByCode(String typeCode) {
        if (null == typeCode) {
            return null;
        }
        for (ProjectDictTypeEnum projectDictTypeEnum : ProjectDictTypeEnum.values()) {
            if (projectDictTypeEnum.typeCode.equals(typeCode)) {
                return projectDictTypeEnum;
            }
        }
        return null;
    }

    public String getTypeCode() {
        return typeCode;
    }

    public String getDesc() {
        return desc;
    }}
